## Copyright (C) 2010 E. Zuniga J. Hidalgo
##
## This file is used for the DSP course 
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or (at
## your option) any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {} verParcial(@var{N})
## La funcion verParcial(N) recibe un valor N y grafica las primeras N
## muestras para las fuciones y=sin(2*pi*f*n) con f =[0.01,0.02,0.05,0.1]
## Dicha funcion muestra las graficas separadas en una misma hoja
## Ademas permite almancenar la grafica en un archivo formato EPS.
## @seealso{stem, plot, print}
## @end deftypefn
## Autores: Esteban zuniga  y  Jorge hidalgo
## Creado: Agosto 2010

function verParcial (n1,n2)
	n11 = [0:n1].';
	n21 = [0:n2].';
	f = [0.05,1.05];
	subplot(2,1,1) 
	y1= sin(2*pi*f(1,1)*n11); 
	stem(y1)
	title ("sin (2*pi*0.05*n)");
	subplot(2,1,2)
	y2= sin(2*pi*f(1,2)*n21); 
	stem(y2,"b");
	title("sin (2*pi*1.05*n)");
	print -deps -color alias-positivo.eps
end

fs=44100; % frecuencia de muestreo
duration=2; % Recording duration 
waveFile='archivocreado.wav'; % Wav file to be saved
fprintf('Press any key to start %g seconds of recording...', duration); 
pause fprintf('Recording...'); 
y= sin(2*pi*440*) 
fprintf('Finished recording.\n'); 
fprintf('Press any key to save the sound data to %s...', waveFile); 
pause nbits=8; % Bit resolution
wavwrite(y, fs, nbits, waveFile); 
fprintf('Finished writing %s\n', waveFile);
fprintf('Press any key to play %s...\n', waveFile); 
dos(['start ', waveFile]); % Start the application for .wav file 
